package 剑指offer;


/**
 * @ClassName _24反转链表
 * @Description TODO
 * @Author 昝亚杰
 * @Date 2022/2/23 20:09
 * Version 1.0
 **/
public class _24反转链表 {
/*    public ListNode reverseList(ListNode head) {//迭代
        ListNode pre = null;
        ListNode cur = head;
        ListNode next = null;
        while(cur != null){
            next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;
        }
        return pre;
    }*/

/*    public ListNode reverseList(ListNode head) {//递归
        if(head == null || head.next ==null){
            return head;
        }
        ListNode newHead = reverseList(head.next);
        head.next.next = head;
        head.next = null;
        return newHead;
    }*/
}
